package com.API;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

public class DateTime06 {
    public static void main(String[] args) {
        LocalDateTime localDateTime = LocalDateTime.of(2020, 11, 21, 11, 31, 41);
        DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy年MM月dd日 HH:mm:ss");
        String s = localDateTime.format(dateTimeFormatter);
        System.out.println(s);

    }

    public static void method() {
        String s = "2020年11月21日11:31:41";

        DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy年MM月dd日 HH:mm:ss");
        LocalDateTime parse = LocalDateTime.parse(s, dateTimeFormatter);
        System.out.println(parse);
    }
}
